using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Data/State/Player/PlayerFallG", fileName = "PlayerFallG")]
public class PlayerState_FallG : PlayerState
{
    [SerializeField] private AnimationCurve animationCurve;
    [SerializeField] private float playerFallMoveSpeed;
    //
    public override void Enter()
    {
        base.Enter();
        playerStatusInformation.SetIsInvincible = true;
        playerFoot.SetActive(false);
    }
    
    //
    public override void Exit()
    {
        base.Exit();
        playerStatusInformation.SetIsInvincible = false;
        playerFoot.SetActive(true);
    }
    
    //
    public override void LogicUpdate()
    {
        base.LogicUpdate();
        if(isAnimationFinished)
            stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Fall)]);
        // if(isAnimationFinished)
            // return;
        // if(playerDetection.GetIsGround)
            // stateMachine.SwitchState(stateMachine.stateTable[typeof(PlayerState_Idle)]);
    }
    
    //
    public override void PhysicalUpdate()
    {
        base.PhysicalUpdate();
        animator.SetFloat("Horizontal", playerInput.axesX);
        playerControl.SetVelocityY(animationCurve.Evaluate(stateDuration));
        playerControl.SetVelocityX(playerFallMoveSpeed);
    }
}
